* CREATE SINGLE FILE FOR PARENTS
clear all
* Change directory to Data path
*cd "/Users/michelletorres/Dropbox/3rdYearPaper/MSM_Final/Replication Files/Data"
use "DataParent.dta", clear
drop if V4==1306 & V319==412
* Delete subjects whose parent(s) were not interviewed
keep if V318!=9 
keep V4 V318 V272 V273 V520 V524 V594 V509 - V513 V576 V288 V547 V549 V550 V289 V575 V574  V296 V297 V341 V382 V431 V425 V428 V452 V557 V558 V591 V593 V595 V596 V599 V584 V587

******** RECODE MISSINGS
recode V272 V273 V520 V524 V594 V557 (90 98 99 =.)
recode V288 V289 V547 V549 V550 (0 888 999 =.)
recode V575 V574 (80 88 99=.)
recode V452 V341  (8 9=.)
recode V558 V428  (0 9=.)
recode V431 (0 40 88 99=.) 
recode V318 V509 V576 V425 V596 V599 V382 V591 V593 V595 V587 (9=.)
recode V510 (4=.)
recode V511 (0 19 99=.)
recode V512 V513 (99=.)

**** TYPO
replace V272=51 if V4==1307

**** INDIC FOR FATHER

* Variables I need
* v318: Data source, 2=Mother; 3=Father
gen father_interviewed = .
* Mother
replace father_interviewed =1 if V318==2 
* Father
replace father_interviewed =2 if V318==3 

reshape wide V318-V599 , i(V4) j(father_interviewed)


**** Education father
* Responses from father
gen educ_dad = V5942
* If missing, replace with HOH education when parents are married
replace educ_dad = V5201 if V4251==1 & educ_dad==.
* Replace education of father as reported by the student
replace educ_dad = V272 if educ_dad==. 

**** Education mother
* Responses from father
gen educ_mom = V5941
* If missing, replace with wife of HOH education
replace educ_dad = V5241 if educ_dad==.
replace educ_dad = V5242 if educ_dad==.
* Replace education of mother as reported by the student
replace educ_dad = V273 if educ_dad==. 

**** RECODE EDUCATION: 1=Less than HS, 2= Incomplete HS, 3= HS + Non-college training, 4=Some College 5=College 6=More than college
recode educ_mom educ_dad (0/16=1) (17/33=2) (34/61=3) (71 72 =4) (81 = 5) (82/87=6)


***** Occupation (1= Professional and technical/Self-employed businessmen, managers and officials;
* 2= clerical and sales/Skilled workers; 3= Semi skilled workers/Service workers, 4= unskilled laborers/farm operators, 5 = unemployed)
gen occup_hoh = V5122
replace occup_hoh = V5121 if occup_hoh==.
recode occup_hoh (1/29=1) (31/49=2)(50/69=3) (71/89=4) (91/96=.)


**** Race (1=White, 2=Black, 8=Other)
gen race_hoh = V5842
replace race_hoh = V5841 if race_hoh==.

*** Income
gen income_fam = V5742
replace income_fam = V5741 if income_fam==.
xtile qinc_fam =income_fam, nquantiles(4)

*** Own a house (1=Owns a house, 0=Rent/Other/Weird responses)
gen ownhome_hoh = V5762
replace ownhome_hoh = V5761 if ownhome_hoh ==.
replace ownhome_hoh = 0 if ownhome_hoh>1

**************************
*** POLITICAL VARIABLES **
**************************

*** Political interest (1=Most of the time, 2=Some of the time, 3=Only now and then, 4=Hardly at all)
gen polint_hoh = V4522
replace polint_hoh = V4521 if polint_hoh==.

*** Frequency of news (1=Daily, 2=2 times a week, 3=3 or 4 times a month, 4=few times a year, 5=Nothing, 7=Yes but no freq)
gen fnews_hoh = V3412
replace fnews_hoh = V3411 if fnews_hoh==.
recode fnews_hoh (7=4)

*** Party ID 
* Long (1=Strong democrat, 2=Democrat, 3=Not very strong Democrat, 4= Neither, 5=Not very strong Republican, 6=Republican, 7=Strong Republican, 8=Apolitical/Other) 
gen pid7_hoh = .
gen pid7_hoh_t = V3822
replace pid7_hoh_t = V3821 if pid7_hoh_t==.
replace pid7_hoh= 1 if pid7_hoh_t==1
replace pid7_hoh= 2 if pid7_hoh_t==3
replace pid7_hoh= 3 if pid7_hoh_t==2
replace pid7_hoh= 4 if pid7_hoh_t==4
replace pid7_hoh= 8 if pid7_hoh_t==0
replace pid7_hoh= 8 if pid7_hoh_t==8
replace pid7_hoh= 5 if pid7_hoh_t==6
replace pid7_hoh= 6 if pid7_hoh_t==5
replace pid7_hoh= 7 if pid7_hoh_t==7

* Short 
* Version 1: 1=Republican, 2=Neither, 3=Democrat
gen pids3_hoh = pid7_hoh
recode pids3_hoh (1/3=3) (5/7=1) (4=2) (8=2)
* Version 2: (1=Democrat, 2=Neither, 3=Republican, 4=Other/Apolitical)
gen pid3_hoh = pid7_hoh
recode pid3_hoh (1/3=1) (5/7=3) (4=2) (8=4)

*** Cosmopolitanism
gen cosmo_hoh = V5912
replace cosmo_hoh = V5911 if cosmo_hoh==.

******************
* STUDENTS DEMS **
******************

gen gender_st65 = V296

drop V3181-V289
drop V296 V297
drop pid7_hoh_t pids3_hoh pid7_hoh_t income_fam

rename V4 caseID65

save "Final_Data_Parents.dta", replace
